from sqlalchemy.dialects.mysql import INTEGER, VARCHAR,FLOAT,JSON
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base
from pydantic import BaseModel


Base = declarative_base()


class GroundSensor(Base):
    __tablename__ = 'downhole_sensor'
    id = Column(INTEGER, primary_key=True)
    colliery_id = Column(INTEGER, default=0)
    mine_id = Column(INTEGER, default=0)
    chanel = Column(VARCHAR(255), nullable=False)
    sensor_number = Column(VARCHAR(255), nullable=False)
    coefficient = Column(FLOAT, default=0, nullable=False)
    stress_matrix = Column(JSON, nullable=False)
    transformation_matrix = Column(JSON, nullable=False)
    wavelength = Column(INTEGER, default=0)
    sensor_status = Column(VARCHAR(255), nullable=False)
    setup_time = Column(INTEGER, default=0)
    create_time = Column(INTEGER, default=0)
    update_time = Column(INTEGER, default=0)


class FormBody(BaseModel):
    mine_id:int
    sensor_number:str
    chanel:str
    setup_time:int
    sensor_status:str
    coefficient:float
    stress_matrix:list
    transformation_matrix:list
    wavelength:int



class EditBody(BaseModel):
    sensor_id:int
    sensor_number:str
    chanel:str
    setup_time:int
    sensor_status:str
    coefficient:float
    stress_matrix:list
    transformation_matrix:list
    wavelength:int
